-
Notifications
You must be signed in to change notification settings - Fork 354
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework api.derive.balance.{account, all} to work with the new frame account data #5955
Conversation
This is nice since so many people recalculate this. Is it broadcast anywhere? |
I haven't thought about broadcasting this, but totally can in channels. The release should be out today then propagated downstream in the pjs libs to apps. |
Yes, but I'd actually say this code is a great example to be moved into a runtime api. The runtime knows end of the day how much is transferrable better than anyone else. |
Yes, I totally agree this should be a runtime-api. I think back to the |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
closes: #5856
Changes
DeriveBalancesAllAccountData
: This now adds a new fieldtransferable
which has a type ofBalance | null
. This will only be applicable if the underlying runtime supportsFrameSystemAccountInfo
type.DeriveBalancesAccountData
: This now adds an optional fieldframeSystemAccountInfo
which returns 2 fields (frozen, and flags) that were not present in olderAccountData
formats.Transferable Formula
free - max(frozen - reserve, ed)
edit: Formula changed to
free - max(0, frozen - reserve)
in #5956